Component({
    options: {
        multipleSlots: true // 启用多 slot 支持
    },
    properties: {
        visible: {
            type: Boolean,
            value: false
        },
        title: {
            type: String,
            value: ''
        },
        content: {
            type: String,
            value: '提示内容'
        },
        useSlot: {
            type: Boolean, // 是否使用 slot 传入内容
            value: false
        },
        showConfirmButton: {
            type: Boolean,
            value: true
        },
        showCancelButton: {
            type: Boolean,
            value: true
        },
        confirmText: {
            type: String,
            value: '确定'
        },
        cancelText: {
            type: String,
            value: '取消'
        },
        closeOnClickMask: { // 是否允许点击遮罩层关闭弹窗
            type: Boolean,
            value: true
        }
    },
    data: {},
    methods: {
        handleMaskClick() {
            if (this.data.closeOnClickMask) {
                this.hideModal();
            }
        },
        preventBubble() {
            // 阻止事件冒泡，空函数即可
        },
        showModal() {
            this.setData({ visible: true });
        },
        hideModal() {
            this.setData({ visible: false });
        },
        handleCancel() {
            this.hideModal();
            this.triggerEvent('cancel');
        },
        handleConfirm() {
            this.hideModal();
            this.triggerEvent('confirm');
        }
    }
}); 